﻿namespace HRM.CORE.Machine
{
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Mask;
    using DevExpress.XtraLayout;
    using DevExpress.XtraLayout.Utils;
    using DevExpress.XtraTab;
    using Service;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;
    using zkemkeeper;
    using System.Runtime.InteropServices;

    
    public class xfmMachineInformation : XtraForm
    {
        //[ComImport]
        //[Guid("00853A19-BD51-419B-9269-2DABE57EB61F")]
        private CZKEMClass axCZKEM;
        private SimpleButton btGetDeviceTime;
        private SimpleButton btPowerOff;
        private SimpleButton btRestart;
        private SimpleButton btSetDeviceTime;
        private IContainer components;
        private DateEdit dtSetDeviceTime;
        private GroupBox groupBox1;
        private GroupBox groupBox2;
        private LayoutControl layoutControl1;
        private LayoutControlGroup layoutControlGroup1;
        private LayoutControlItem layoutControlItem1;
        private LayoutControlItem layoutControlItem10;
        private LayoutControlItem layoutControlItem11;
        private LayoutControlItem layoutControlItem12;
        private LayoutControlItem layoutControlItem2;
        private LayoutControlItem layoutControlItem3;
        private LayoutControlItem layoutControlItem4;
        private LayoutControlItem layoutControlItem5;
        private LayoutControlItem layoutControlItem6;
        private LayoutControlItem layoutControlItem7;
        private LayoutControlItem layoutControlItem8;
        private LayoutControlItem layoutControlItem9;
        private int m_MachineNumber;
        private XtraTabPage tabControl;
        private XtraTabPage tabInformation;
        private TextEdit txtCardFun;
        private TextEdit txtDeviceInfo;
        private TextEdit txtDeviceIP;
        private TextEdit txtDeviceMAC;
        private TextEdit txtFirmwareVersion;
        private TextEdit txtGetDeviceTime;
        private TextEdit txtIsTFTMachine;
        private TextEdit txtPlatform;
        private TextEdit txtProductCode;
        private TextEdit txtQueryState;
        private TextEdit txtSDKVersion;
        private TextEdit txtSerialNumber;
        private TextEdit txtSysOption;
        private XtraTabControl xtraTabControl1;

        public event PowerOffDeviceEventHander PowerOffDevice;

        public event RestartDeviceEventHander RestartDevice;

        public xfmMachineInformation()
        {
            this.components = null;
            this.InitializeComponent();
        }

        public xfmMachineInformation(CZKEMClass czkemClass, string MachineName, string IP, int MachineNumber)
        {
            this.components = null;
            this.InitializeComponent();
            this.Text = "Th\x00f4ng Tin Thiết Bị - " + MachineName;
            this.txtDeviceIP.Text = IP;
            this.m_MachineNumber = MachineNumber;
            this.axCZKEM = czkemClass;
            this.GetInformation();
        }

        private void btGetDeviceTime_Click(object sender, EventArgs e)
        {
            int dwErrorCode = 0;
            int dwYear = 0;
            int dwMonth = 0;
            int dwDay = 0;
            int dwHour = 0;
            int dwMinute = 0;
            int dwSecond = 0;
            this.Cursor = Cursors.WaitCursor;
            if (this.axCZKEM.GetDeviceTime(this.m_MachineNumber, ref dwYear, ref dwMonth, ref dwDay, ref dwHour, ref dwMinute, ref dwSecond))
            {
                this.txtGetDeviceTime.Text = dwYear.ToString() + "-" + dwMonth.ToString() + "-" + dwDay.ToString() + " " + dwHour.ToString() + ":" + dwMinute.ToString() + ":" + dwSecond.ToString();
            }
            else
            {
                this.axCZKEM.GetLastError(ref dwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + dwErrorCode.ToString(), "Error");
            }
            this.Cursor = Cursors.Default;
        }

        private void btPowerOff_Click(object sender, EventArgs e)
        {
            if (this.IsLicense())
            {
                this.Cursor = Cursors.WaitCursor;
                if (this.axCZKEM.PowerOffDevice(this.m_MachineNumber))
                {
                    MessageBox.Show("Thiết bị sẽ bị tắt!", "Th\x00f4ng B\x00e1o");
                }
                this.RaisePowerOffDeiceEventHander();
                this.Cursor = Cursors.Default;
                base.Close();
            }
        }

        private void btRestart_Click(object sender, EventArgs e)
        {
            if (this.IsLicense())
            {
                this.Cursor = Cursors.WaitCursor;
                if (this.axCZKEM.RestartDevice(this.m_MachineNumber))
                {
                    MessageBox.Show("Thiết bị sẽ được khởi động lại!", "Th\x00f4ng B\x00e1o");
                }
                this.RaiseRestartDeviceEventHander();
                this.Cursor = Cursors.Default;
                base.Close();
            }
        }

        private void btSetDeviceTime_Click(object sender, EventArgs e)
        {
            if (this.IsLicense())
            {
                int dwErrorCode = 0;
                int year = this.dtSetDeviceTime.DateTime.Year;
                int month = this.dtSetDeviceTime.DateTime.Month;
                int day = this.dtSetDeviceTime.DateTime.Day;
                int hour = this.dtSetDeviceTime.DateTime.Hour;
                int minute = this.dtSetDeviceTime.DateTime.Minute;
                int second = this.dtSetDeviceTime.DateTime.Second;
                this.Cursor = Cursors.WaitCursor;
                if (this.axCZKEM.SetDeviceTime2(this.m_MachineNumber, year, month, day, hour, minute, second))
                {
                    this.axCZKEM.RefreshData(this.m_MachineNumber);
                    MessageBox.Show("Successfully set the time of the machine as you have set!", "Error");
                }
                else
                {
                    this.axCZKEM.GetLastError(ref dwErrorCode);
                    MessageBox.Show("Operation failed,ErrorCode=" + dwErrorCode.ToString(), "Error");
                }
                this.Cursor = Cursors.Default;
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void GetInformation()
        {
            this.dtSetDeviceTime.DateTime = DateTime.Now;
            if (this.axCZKEM.IsTFTMachine(this.m_MachineNumber))
            {
                this.txtIsTFTMachine.Text = "Yes";
            }
            else
            {
                this.txtIsTFTMachine.Text = "No";
            }
            int dwInfo = 1;
            string str = "";
            if (this.axCZKEM.GetDeviceStrInfo(this.m_MachineNumber, dwInfo, out str))
            {
                this.txtDeviceInfo.Text = str;
            }
            else
            {
                this.txtDeviceInfo.Text = "";
            }
            string option = "~PIN2Width";
            str = "";
            if (this.axCZKEM.GetSysOption(this.m_MachineNumber, option, out str))
            {
                this.txtSysOption.Text = str;
            }
            else
            {
                this.txtSysOption.Text = "";
            }
            str = "";
            if (this.axCZKEM.GetDeviceMAC(this.m_MachineNumber, ref str))
            {
                this.txtDeviceMAC.Text = str;
            }
            else
            {
                this.txtDeviceMAC.Text = "";
            }
            str = "";
            if (this.axCZKEM.GetFirmwareVersion(this.m_MachineNumber, ref str))
            {
                this.txtFirmwareVersion.Text = str;
            }
            else
            {
                this.txtFirmwareVersion.Text = "";
            }
            str = "";
            if (this.axCZKEM.GetProductCode(this.m_MachineNumber, out str))
            {
                this.txtProductCode.Text = str;
            }
            else
            {
                this.txtProductCode.Text = "";
            }
            str = "";
            if (this.axCZKEM.GetPlatform(this.m_MachineNumber, ref str))
            {
                this.txtPlatform.Text = str;
            }
            else
            {
                this.txtPlatform.Text = "";
            }
            int cardFun = 0;
            if (this.axCZKEM.GetCardFun(this.m_MachineNumber, ref cardFun))
            {
                this.txtCardFun.Text = cardFun.ToString();
            }
            else
            {
                this.txtCardFun.Text = "";
            }
            str = "";
            if (this.axCZKEM.GetSerialNumber(this.m_MachineNumber, out str))
            {
                this.txtSerialNumber.Text = str;
            }
            else
            {
                this.txtSerialNumber.Text = "";
            }
            str = "";
            if (this.axCZKEM.GetSDKVersion(ref str))
            {
                this.txtSDKVersion.Text = str;
            }
            else
            {
                this.txtSDKVersion.Text = "";
            }
            int state = 0;
            if (this.axCZKEM.QueryState(ref state))
            {
                this.txtQueryState.Text = state.ToString();
            }
            else
            {
                this.txtQueryState.Text = "";
            }
        }

        private void InitializeComponent()
        {
            this.xtraTabControl1 = new XtraTabControl();
            this.tabInformation = new XtraTabPage();
            this.layoutControl1 = new LayoutControl();
            this.txtQueryState = new TextEdit();
            this.txtSDKVersion = new TextEdit();
            this.txtDeviceIP = new TextEdit();
            this.txtSerialNumber = new TextEdit();
            this.txtCardFun = new TextEdit();
            this.txtPlatform = new TextEdit();
            this.txtProductCode = new TextEdit();
            this.txtFirmwareVersion = new TextEdit();
            this.txtDeviceMAC = new TextEdit();
            this.txtSysOption = new TextEdit();
            this.txtDeviceInfo = new TextEdit();
            this.txtIsTFTMachine = new TextEdit();
            this.layoutControlGroup1 = new LayoutControlGroup();
            this.layoutControlItem1 = new LayoutControlItem();
            this.layoutControlItem2 = new LayoutControlItem();
            this.layoutControlItem3 = new LayoutControlItem();
            this.layoutControlItem4 = new LayoutControlItem();
            this.layoutControlItem5 = new LayoutControlItem();
            this.layoutControlItem6 = new LayoutControlItem();
            this.layoutControlItem7 = new LayoutControlItem();
            this.layoutControlItem8 = new LayoutControlItem();
            this.layoutControlItem9 = new LayoutControlItem();
            this.layoutControlItem10 = new LayoutControlItem();
            this.layoutControlItem11 = new LayoutControlItem();
            this.layoutControlItem12 = new LayoutControlItem();
            this.tabControl = new XtraTabPage();
            this.groupBox2 = new GroupBox();
            this.btGetDeviceTime = new SimpleButton();
            this.btSetDeviceTime = new SimpleButton();
            this.dtSetDeviceTime = new DateEdit();
            this.txtGetDeviceTime = new TextEdit();
            this.groupBox1 = new GroupBox();
            this.btPowerOff = new SimpleButton();
            this.btRestart = new SimpleButton();
            this.xtraTabControl1.BeginInit();
            this.xtraTabControl1.SuspendLayout();
            this.tabInformation.SuspendLayout();
            this.layoutControl1.BeginInit();
            this.layoutControl1.SuspendLayout();
            this.txtQueryState.Properties.BeginInit();
            this.txtSDKVersion.Properties.BeginInit();
            this.txtDeviceIP.Properties.BeginInit();
            this.txtSerialNumber.Properties.BeginInit();
            this.txtCardFun.Properties.BeginInit();
            this.txtPlatform.Properties.BeginInit();
            this.txtProductCode.Properties.BeginInit();
            this.txtFirmwareVersion.Properties.BeginInit();
            this.txtDeviceMAC.Properties.BeginInit();
            this.txtSysOption.Properties.BeginInit();
            this.txtDeviceInfo.Properties.BeginInit();
            this.txtIsTFTMachine.Properties.BeginInit();
            this.layoutControlGroup1.BeginInit();
            this.layoutControlItem1.BeginInit();
            this.layoutControlItem2.BeginInit();
            this.layoutControlItem3.BeginInit();
            this.layoutControlItem4.BeginInit();
            this.layoutControlItem5.BeginInit();
            this.layoutControlItem6.BeginInit();
            this.layoutControlItem7.BeginInit();
            this.layoutControlItem8.BeginInit();
            this.layoutControlItem9.BeginInit();
            this.layoutControlItem10.BeginInit();
            this.layoutControlItem11.BeginInit();
            this.layoutControlItem12.BeginInit();
            this.tabControl.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.dtSetDeviceTime.Properties.VistaTimeProperties.BeginInit();
            this.dtSetDeviceTime.Properties.BeginInit();
            this.txtGetDeviceTime.Properties.BeginInit();
            this.groupBox1.SuspendLayout();
            base.SuspendLayout();
            this.xtraTabControl1.Dock = DockStyle.Fill;
            this.xtraTabControl1.Location = new Point(4, 4);
            this.xtraTabControl1.Name = "xtraTabControl1";
            this.xtraTabControl1.SelectedTabPage = this.tabInformation;
            this.xtraTabControl1.Size = new Size(0x169, 0x15f);
            this.xtraTabControl1.TabIndex = 0;
            this.xtraTabControl1.TabPages.AddRange(new XtraTabPage[] { this.tabInformation, this.tabControl });
            this.tabInformation.Controls.Add(this.layoutControl1);
            this.tabInformation.Name = "tabInformation";
            this.tabInformation.Size = new Size(0x162, 0x142);
            this.tabInformation.Text = "Th\x00f4ng Tin Thiết Bị";
            this.layoutControl1.Controls.Add(this.txtQueryState);
            this.layoutControl1.Controls.Add(this.txtSDKVersion);
            this.layoutControl1.Controls.Add(this.txtDeviceIP);
            this.layoutControl1.Controls.Add(this.txtSerialNumber);
            this.layoutControl1.Controls.Add(this.txtCardFun);
            this.layoutControl1.Controls.Add(this.txtPlatform);
            this.layoutControl1.Controls.Add(this.txtProductCode);
            this.layoutControl1.Controls.Add(this.txtFirmwareVersion);
            this.layoutControl1.Controls.Add(this.txtDeviceMAC);
            this.layoutControl1.Controls.Add(this.txtSysOption);
            this.layoutControl1.Controls.Add(this.txtDeviceInfo);
            this.layoutControl1.Controls.Add(this.txtIsTFTMachine);
            this.layoutControl1.Dock = DockStyle.Fill;
            this.layoutControl1.Location = new Point(0, 0);
            this.layoutControl1.Name = "layoutControl1";
            this.layoutControl1.Root = this.layoutControlGroup1;
            this.layoutControl1.Size = new Size(0x162, 0x142);
            this.layoutControl1.TabIndex = 0;
            this.layoutControl1.Text = "layoutControl1";
            this.txtQueryState.Location = new Point(0x62, 0x114);
            this.txtQueryState.Name = "txtQueryState";
            this.txtQueryState.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtQueryState.Properties.Appearance.Options.UseFont = true;
            this.txtQueryState.Properties.Appearance.Options.UseTextOptions = true;
            this.txtQueryState.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtQueryState.Properties.ReadOnly = true;
            this.txtQueryState.Size = new Size(0xf4, 20);
            this.txtQueryState.StyleController = this.layoutControl1;
            this.txtQueryState.TabIndex = 15;
            this.txtSDKVersion.Location = new Point(0x62, 0xfc);
            this.txtSDKVersion.Name = "txtSDKVersion";
            this.txtSDKVersion.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtSDKVersion.Properties.Appearance.Options.UseFont = true;
            this.txtSDKVersion.Properties.Appearance.Options.UseTextOptions = true;
            this.txtSDKVersion.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtSDKVersion.Properties.ReadOnly = true;
            this.txtSDKVersion.Size = new Size(0xf4, 20);
            this.txtSDKVersion.StyleController = this.layoutControl1;
            this.txtSDKVersion.TabIndex = 14;
            this.txtDeviceIP.Location = new Point(0x62, 0xe4);
            this.txtDeviceIP.Name = "txtDeviceIP";
            this.txtDeviceIP.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtDeviceIP.Properties.Appearance.Options.UseFont = true;
            this.txtDeviceIP.Properties.Appearance.Options.UseTextOptions = true;
            this.txtDeviceIP.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtDeviceIP.Properties.ReadOnly = true;
            this.txtDeviceIP.Size = new Size(0xf4, 20);
            this.txtDeviceIP.StyleController = this.layoutControl1;
            this.txtDeviceIP.TabIndex = 13;
            this.txtSerialNumber.Location = new Point(0x62, 0xcc);
            this.txtSerialNumber.Name = "txtSerialNumber";
            this.txtSerialNumber.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtSerialNumber.Properties.Appearance.Options.UseFont = true;
            this.txtSerialNumber.Properties.Appearance.Options.UseTextOptions = true;
            this.txtSerialNumber.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtSerialNumber.Properties.ReadOnly = true;
            this.txtSerialNumber.Size = new Size(0xf4, 20);
            this.txtSerialNumber.StyleController = this.layoutControl1;
            this.txtSerialNumber.TabIndex = 12;
            this.txtCardFun.Location = new Point(0x62, 180);
            this.txtCardFun.Name = "txtCardFun";
            this.txtCardFun.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtCardFun.Properties.Appearance.Options.UseFont = true;
            this.txtCardFun.Properties.Appearance.Options.UseTextOptions = true;
            this.txtCardFun.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtCardFun.Properties.ReadOnly = true;
            this.txtCardFun.Size = new Size(0xf4, 20);
            this.txtCardFun.StyleController = this.layoutControl1;
            this.txtCardFun.TabIndex = 11;
            this.txtPlatform.Location = new Point(0x62, 0x9c);
            this.txtPlatform.Name = "txtPlatform";
            this.txtPlatform.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtPlatform.Properties.Appearance.Options.UseFont = true;
            this.txtPlatform.Properties.Appearance.Options.UseTextOptions = true;
            this.txtPlatform.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtPlatform.Properties.ReadOnly = true;
            this.txtPlatform.Size = new Size(0xf4, 20);
            this.txtPlatform.StyleController = this.layoutControl1;
            this.txtPlatform.TabIndex = 10;
            this.txtProductCode.Location = new Point(0x62, 0x84);
            this.txtProductCode.Name = "txtProductCode";
            this.txtProductCode.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtProductCode.Properties.Appearance.Options.UseFont = true;
            this.txtProductCode.Properties.Appearance.Options.UseTextOptions = true;
            this.txtProductCode.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtProductCode.Properties.ReadOnly = true;
            this.txtProductCode.Size = new Size(0xf4, 20);
            this.txtProductCode.StyleController = this.layoutControl1;
            this.txtProductCode.TabIndex = 9;
            this.txtFirmwareVersion.Location = new Point(0x62, 0x6c);
            this.txtFirmwareVersion.Name = "txtFirmwareVersion";
            this.txtFirmwareVersion.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtFirmwareVersion.Properties.Appearance.Options.UseFont = true;
            this.txtFirmwareVersion.Properties.Appearance.Options.UseTextOptions = true;
            this.txtFirmwareVersion.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtFirmwareVersion.Properties.ReadOnly = true;
            this.txtFirmwareVersion.Size = new Size(0xf4, 20);
            this.txtFirmwareVersion.StyleController = this.layoutControl1;
            this.txtFirmwareVersion.TabIndex = 8;
            this.txtDeviceMAC.Location = new Point(0x62, 0x54);
            this.txtDeviceMAC.Name = "txtDeviceMAC";
            this.txtDeviceMAC.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtDeviceMAC.Properties.Appearance.Options.UseFont = true;
            this.txtDeviceMAC.Properties.Appearance.Options.UseTextOptions = true;
            this.txtDeviceMAC.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtDeviceMAC.Properties.ReadOnly = true;
            this.txtDeviceMAC.Size = new Size(0xf4, 20);
            this.txtDeviceMAC.StyleController = this.layoutControl1;
            this.txtDeviceMAC.TabIndex = 7;
            this.txtSysOption.Location = new Point(0x62, 60);
            this.txtSysOption.Name = "txtSysOption";
            this.txtSysOption.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtSysOption.Properties.Appearance.Options.UseFont = true;
            this.txtSysOption.Properties.Appearance.Options.UseTextOptions = true;
            this.txtSysOption.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtSysOption.Properties.ReadOnly = true;
            this.txtSysOption.Size = new Size(0xf4, 20);
            this.txtSysOption.StyleController = this.layoutControl1;
            this.txtSysOption.TabIndex = 6;
            this.txtDeviceInfo.Location = new Point(0x62, 0x24);
            this.txtDeviceInfo.Name = "txtDeviceInfo";
            this.txtDeviceInfo.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtDeviceInfo.Properties.Appearance.Options.UseFont = true;
            this.txtDeviceInfo.Properties.Appearance.Options.UseTextOptions = true;
            this.txtDeviceInfo.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtDeviceInfo.Properties.ReadOnly = true;
            this.txtDeviceInfo.Size = new Size(0xf4, 20);
            this.txtDeviceInfo.StyleController = this.layoutControl1;
            this.txtDeviceInfo.TabIndex = 5;
            this.txtIsTFTMachine.Location = new Point(0x62, 12);
            this.txtIsTFTMachine.Name = "txtIsTFTMachine";
            this.txtIsTFTMachine.Properties.Appearance.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.txtIsTFTMachine.Properties.Appearance.Options.UseFont = true;
            this.txtIsTFTMachine.Properties.Appearance.Options.UseTextOptions = true;
            this.txtIsTFTMachine.Properties.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
            this.txtIsTFTMachine.Properties.ReadOnly = true;
            this.txtIsTFTMachine.Size = new Size(0xf4, 20);
            this.txtIsTFTMachine.StyleController = this.layoutControl1;
            this.txtIsTFTMachine.TabIndex = 4;
            this.layoutControlGroup1.CustomizationFormText = "layoutControlGroup1";
            this.layoutControlGroup1.EnableIndentsWithoutBorders = DefaultBoolean.True;
            this.layoutControlGroup1.GroupBordersVisible = false;
            this.layoutControlGroup1.Items.AddRange(new BaseLayoutItem[] { this.layoutControlItem1, this.layoutControlItem2, this.layoutControlItem3, this.layoutControlItem4, this.layoutControlItem5, this.layoutControlItem6, this.layoutControlItem7, this.layoutControlItem8, this.layoutControlItem9, this.layoutControlItem10, this.layoutControlItem11, this.layoutControlItem12 });
            this.layoutControlGroup1.Location = new Point(0, 0);
            this.layoutControlGroup1.Name = "layoutControlGroup1";
            this.layoutControlGroup1.Size = new Size(0x162, 0x142);
            this.layoutControlGroup1.Spacing = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
            this.layoutControlGroup1.Text = "layoutControlGroup1";
            this.layoutControlGroup1.TextVisible = false;
            this.layoutControlItem1.Control = this.txtIsTFTMachine;
            this.layoutControlItem1.CustomizationFormText = "TFT Machine";
            this.layoutControlItem1.Location = new Point(0, 0);
            this.layoutControlItem1.Name = "layoutControlItem1";
            this.layoutControlItem1.Size = new Size(0x14e, 0x18);
            this.layoutControlItem1.Text = "TFT Machine";
            this.layoutControlItem1.TextSize = new Size(0x52, 13);
            this.layoutControlItem2.Control = this.txtDeviceInfo;
            this.layoutControlItem2.CustomizationFormText = "Device Info";
            this.layoutControlItem2.Location = new Point(0, 0x18);
            this.layoutControlItem2.Name = "layoutControlItem2";
            this.layoutControlItem2.Size = new Size(0x14e, 0x18);
            this.layoutControlItem2.Text = "Device Info";
            this.layoutControlItem2.TextSize = new Size(0x52, 13);
            this.layoutControlItem3.Control = this.txtSysOption;
            this.layoutControlItem3.CustomizationFormText = "SysOption";
            this.layoutControlItem3.Location = new Point(0, 0x30);
            this.layoutControlItem3.Name = "layoutControlItem3";
            this.layoutControlItem3.Size = new Size(0x14e, 0x18);
            this.layoutControlItem3.Text = "SysOption";
            this.layoutControlItem3.TextSize = new Size(0x52, 13);
            this.layoutControlItem4.Control = this.txtDeviceMAC;
            this.layoutControlItem4.CustomizationFormText = "Device MAC";
            this.layoutControlItem4.Location = new Point(0, 0x48);
            this.layoutControlItem4.Name = "layoutControlItem4";
            this.layoutControlItem4.Size = new Size(0x14e, 0x18);
            this.layoutControlItem4.Text = "Device MAC";
            this.layoutControlItem4.TextSize = new Size(0x52, 13);
            this.layoutControlItem5.Control = this.txtFirmwareVersion;
            this.layoutControlItem5.CustomizationFormText = "Firmware Version";
            this.layoutControlItem5.Location = new Point(0, 0x60);
            this.layoutControlItem5.Name = "layoutControlItem5";
            this.layoutControlItem5.Size = new Size(0x14e, 0x18);
            this.layoutControlItem5.Text = "Firmware Version";
            this.layoutControlItem5.TextSize = new Size(0x52, 13);
            this.layoutControlItem6.Control = this.txtProductCode;
            this.layoutControlItem6.CustomizationFormText = "Product Code";
            this.layoutControlItem6.Location = new Point(0, 120);
            this.layoutControlItem6.Name = "layoutControlItem6";
            this.layoutControlItem6.Size = new Size(0x14e, 0x18);
            this.layoutControlItem6.Text = "Product Code";
            this.layoutControlItem6.TextSize = new Size(0x52, 13);
            this.layoutControlItem7.Control = this.txtPlatform;
            this.layoutControlItem7.CustomizationFormText = "Platform";
            this.layoutControlItem7.Location = new Point(0, 0x90);
            this.layoutControlItem7.Name = "layoutControlItem7";
            this.layoutControlItem7.Size = new Size(0x14e, 0x18);
            this.layoutControlItem7.Text = "Platform";
            this.layoutControlItem7.TextSize = new Size(0x52, 13);
            this.layoutControlItem8.Control = this.txtCardFun;
            this.layoutControlItem8.CustomizationFormText = "CardFun";
            this.layoutControlItem8.Location = new Point(0, 0xa8);
            this.layoutControlItem8.Name = "layoutControlItem8";
            this.layoutControlItem8.Size = new Size(0x14e, 0x18);
            this.layoutControlItem8.Text = "CardFun";
            this.layoutControlItem8.TextSize = new Size(0x52, 13);
            this.layoutControlItem9.Control = this.txtSerialNumber;
            this.layoutControlItem9.CustomizationFormText = "SerialNumber";
            this.layoutControlItem9.Location = new Point(0, 0xc0);
            this.layoutControlItem9.Name = "layoutControlItem9";
            this.layoutControlItem9.Size = new Size(0x14e, 0x18);
            this.layoutControlItem9.Text = "SerialNumber";
            this.layoutControlItem9.TextSize = new Size(0x52, 13);
            this.layoutControlItem10.Control = this.txtDeviceIP;
            this.layoutControlItem10.CustomizationFormText = "Device IP";
            this.layoutControlItem10.Location = new Point(0, 0xd8);
            this.layoutControlItem10.Name = "layoutControlItem10";
            this.layoutControlItem10.Size = new Size(0x14e, 0x18);
            this.layoutControlItem10.Text = "Device IP";
            this.layoutControlItem10.TextSize = new Size(0x52, 13);
            this.layoutControlItem11.Control = this.txtSDKVersion;
            this.layoutControlItem11.CustomizationFormText = "SDK Version";
            this.layoutControlItem11.Location = new Point(0, 240);
            this.layoutControlItem11.Name = "layoutControlItem11";
            this.layoutControlItem11.Size = new Size(0x14e, 0x18);
            this.layoutControlItem11.Text = "SDK Version";
            this.layoutControlItem11.TextSize = new Size(0x52, 13);
            this.layoutControlItem12.Control = this.txtQueryState;
            this.layoutControlItem12.CustomizationFormText = "Query State";
            this.layoutControlItem12.Location = new Point(0, 0x108);
            this.layoutControlItem12.Name = "layoutControlItem12";
            this.layoutControlItem12.Size = new Size(0x14e, 0x26);
            this.layoutControlItem12.Text = "Query State";
            this.layoutControlItem12.TextSize = new Size(0x52, 13);
            this.tabControl.Controls.Add(this.groupBox2);
            this.tabControl.Controls.Add(this.groupBox1);
            this.tabControl.Name = "tabControl";
            this.tabControl.Size = new Size(0x162, 0x142);
            this.tabControl.Text = "Điều Khiển Thiết Bị";
            this.groupBox2.Controls.Add(this.btGetDeviceTime);
            this.groupBox2.Controls.Add(this.btSetDeviceTime);
            this.groupBox2.Controls.Add(this.dtSetDeviceTime);
            this.groupBox2.Controls.Add(this.txtGetDeviceTime);
            this.groupBox2.Location = new Point(15, 0x81);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new Size(0x142, 0x67);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Thiết lập thời gian cho thiết bị";
            this.btGetDeviceTime.Location = new Point(0xcd, 0x1d);
            this.btGetDeviceTime.Name = "btGetDeviceTime";
            this.btGetDeviceTime.Size = new Size(0x60, 0x17);
            this.btGetDeviceTime.TabIndex = 3;
            this.btGetDeviceTime.Text = "Lấy Giờ";
            this.btGetDeviceTime.Click += new EventHandler(this.btGetDeviceTime_Click);
            this.btSetDeviceTime.Location = new Point(0xcd, 0x3f);
            this.btSetDeviceTime.Name = "btSetDeviceTime";
            this.btSetDeviceTime.Size = new Size(0x60, 0x17);
            this.btSetDeviceTime.TabIndex = 1;
            this.btSetDeviceTime.Text = "Thiết Lập";
            this.btSetDeviceTime.Click += new EventHandler(this.btSetDeviceTime_Click);
            this.dtSetDeviceTime.EditValue = new DateTime(0x7dd, 5, 9, 0, 0, 0, 0);
            this.dtSetDeviceTime.Location = new Point(0x13, 0x41);
            this.dtSetDeviceTime.Name = "dtSetDeviceTime";
            this.dtSetDeviceTime.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.dtSetDeviceTime.Properties.DisplayFormat.FormatString = "dd/MM/yyyy hh:mm:ss";
            this.dtSetDeviceTime.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.dtSetDeviceTime.Properties.EditFormat.FormatString = "dd/MM/yyyy hh:mm:ss";
            this.dtSetDeviceTime.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.dtSetDeviceTime.Properties.Mask.EditMask = "dd/MM/yyyy hh:mm:ss";
            this.dtSetDeviceTime.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.dtSetDeviceTime.Size = new Size(180, 20);
            this.dtSetDeviceTime.TabIndex = 0;
            this.txtGetDeviceTime.EditValue = "";
            this.txtGetDeviceTime.Location = new Point(0x13, 0x1f);
            this.txtGetDeviceTime.Name = "txtGetDeviceTime";
            this.txtGetDeviceTime.Properties.DisplayFormat.FormatString = "dd/MM/yyyy hh:mm:ss";
            this.txtGetDeviceTime.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.txtGetDeviceTime.Properties.EditFormat.FormatString = "dd/MM/yyyy hh:mm:ss";
            this.txtGetDeviceTime.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.txtGetDeviceTime.Properties.Mask.EditMask = "dd/MM/yyyy hh:mm:ss";
            this.txtGetDeviceTime.Properties.Mask.MaskType = MaskType.DateTime;
            this.txtGetDeviceTime.Properties.ReadOnly = true;
            this.txtGetDeviceTime.Size = new Size(180, 20);
            this.txtGetDeviceTime.TabIndex = 2;
            this.txtGetDeviceTime.TabStop = false;
            this.groupBox1.Controls.Add(this.btPowerOff);
            this.groupBox1.Controls.Add(this.btRestart);
            this.groupBox1.Location = new Point(15, 14);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Size(0x142, 100);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Khởi động lại hoặc tắt m\x00e1y";
            this.btPowerOff.Location = new Point(0x13, 0x3e);
            this.btPowerOff.Name = "btPowerOff";
            this.btPowerOff.Size = new Size(0x11a, 0x17);
            this.btPowerOff.TabIndex = 1;
            this.btPowerOff.Text = "Tắt Nguồn Thiết Bị";
            this.btPowerOff.Click += new EventHandler(this.btPowerOff_Click);
            this.btRestart.Location = new Point(0x13, 30);
            this.btRestart.Name = "btRestart";
            this.btRestart.Size = new Size(0x11a, 0x17);
            this.btRestart.TabIndex = 0;
            this.btRestart.Text = "Khởi Động Lại Thiết Bị";
            this.btRestart.Click += new EventHandler(this.btRestart_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
//            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x171, 0x167);
            base.Controls.Add(this.xtraTabControl1);
//            base.FormBorderStyle = FormBorderStyle.FixedDialog;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "xfmMachineInformation";
            base.Padding = new System.Windows.Forms.Padding(4);
            base.ShowIcon = false;
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text = "Th\x00f4ng Tin Thiết Bị";
            base.Load += new EventHandler(this.xfmMachineInformation_Load);
            this.xtraTabControl1.EndInit();
            this.xtraTabControl1.ResumeLayout(false);
            this.tabInformation.ResumeLayout(false);
            this.layoutControl1.EndInit();
            this.layoutControl1.ResumeLayout(false);
            this.txtQueryState.Properties.EndInit();
            this.txtSDKVersion.Properties.EndInit();
            this.txtDeviceIP.Properties.EndInit();
            this.txtSerialNumber.Properties.EndInit();
            this.txtCardFun.Properties.EndInit();
            this.txtPlatform.Properties.EndInit();
            this.txtProductCode.Properties.EndInit();
            this.txtFirmwareVersion.Properties.EndInit();
            this.txtDeviceMAC.Properties.EndInit();
            this.txtSysOption.Properties.EndInit();
            this.txtDeviceInfo.Properties.EndInit();
            this.txtIsTFTMachine.Properties.EndInit();
            this.layoutControlGroup1.EndInit();
            this.layoutControlItem1.EndInit();
            this.layoutControlItem2.EndInit();
            this.layoutControlItem3.EndInit();
            this.layoutControlItem4.EndInit();
            this.layoutControlItem5.EndInit();
            this.layoutControlItem6.EndInit();
            this.layoutControlItem7.EndInit();
            this.layoutControlItem8.EndInit();
            this.layoutControlItem9.EndInit();
            this.layoutControlItem10.EndInit();
            this.layoutControlItem11.EndInit();
            this.layoutControlItem12.EndInit();
            this.tabControl.ResumeLayout(false);
            this.groupBox2.ResumeLayout(false);
            this.dtSetDeviceTime.Properties.VistaTimeProperties.EndInit();
            this.dtSetDeviceTime.Properties.EndInit();
            this.txtGetDeviceTime.Properties.EndInit();
            this.groupBox1.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private bool IsLicense()
        {
            CODE code = new CODE();
            code.CheckLicense();
            code.Execute();
            if ((CODE.TypeSoft == 0) || (CODE.TypeSoft == 1))
            {
                XtraMessageBox.Show("Vui l\x00f2ng nhập m\x00e3 đăng k\x00fd phần mềm để thực hiện chức năng n\x00e0y!", "Th\x00f4ng B\x00e1o");
                return false;
            }
            return true;
        }

        private void RaisePowerOffDeiceEventHander()
        {
            if (this.PowerOffDevice != null)
            {
                this.PowerOffDevice(this);
            }
        }

        private void RaiseRestartDeviceEventHander()
        {
            if (this.RestartDevice != null)
            {
                this.RestartDevice(this);
            }
        }

        private void xfmMachineInformation_Load(object sender, EventArgs e)
        {
        }

        public delegate void PowerOffDeviceEventHander(object sender);

        public delegate void RestartDeviceEventHander(object sender);
    }
}

